<template>
	<view class="wanlguide-container">
		<swiper :style="{ height: winHeiht + 'px' }" circular="true" :duration="duration"
			@change="swiperChange">
			<swiper-item class="item text-center" >
				<image :src="guideImg" mode="aspectFit"></image>
			</swiper-item>
		</swiper>
		<view class="button" :style="{ top: statusBar + 'px' }">
			<button class="cu-btn round" @tap="launchFlag">{{ jumpover }}</button>
		</view>
		
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import { guideImage } from "@/services/home";
	export default {
		data() {
			return {
				height: 0,
				statusBar: 0,
				winHeiht:0,
				current: 0,
				duration: 500,
				jumpover: '跳过',
				experience: '立即体验',
				guideImg:""
			};
		},
		computed: {
			...mapState(['common'])
		},
		onReady() {
			let vm =this
			uni.getSystemInfo({
				success: (result) => {
					console.log(result)
					vm.height = result.statusBarHeight;
					vm.statusBar = result.statusBarHeight;
					vm.winHeiht=result.windowHeight
				},
				})
			
			// #ifdef MP
			
			// #endif
		
		},
		onLoad() {
			guideImage().then(res=>{
				console.log(res)
				this.guideImg=res.data
			})
			this.timer()
		},
		methods: {
			timer(){
				let seconds=3
				const timer = setInterval(() => {
				   
				    seconds--;
				    
				    if (seconds < 0) {
				      clearInterval(timer);
				      uni.switchTab({
				      	url:'/pages/home/home'
				      })
				    }
				  }, 1000);
				
			},
			swiperChange(e) {
				this.current = e.detail.current;
			},
			launchFlag() {
				uni.switchTab({
					url:'/pages/home/home'
				})
				// 向本地存储中设置launchFlag的值，即启动标识；
				
			}
		}
	};
</script>

<style lang="scss">
	.cu-btn.lg {
		font-size: 30rpx;
	}

	.cu-btn:not([class*="bg-"]) {
		background-color: rgba(255, 255, 255, .5);
	}
		
	.cu-btn {
		line-height: 56rpx;
	}

	.wanlguide-container {
		position: relative;

		swiper-item {
			.title {
				margin-bottom: 40rpx;
				line-height: 1.4;
				color: rgba(255, 255, 255, 0.8);

				&>view {
					font-size: 62rpx;
				}

				&text {
					font-size: 32rpx;
					font-weight: 300;
				}
			}
		}

		image {
			width: 100%;
			height: 100%;
		}

		.button {
			position: absolute;
			/* #ifdef MP */
			left: 25rpx;
			/* #endif */
			/* #ifndef MP */
			right: 25rpx;

			/* #endif */
			.cu-btn {
				padding: 0 25rpx;
				font-size: 28rpx;
				height: 56rpx;
				background-color: rgba(0, 0, 0, .2);
				color: rgba(255, 255, 255, .6);
			}
		}

		.experience {
			position: absolute;
			left: 0;
			right: 0;
			bottom: 100rpx;
			display: flex;
			justify-content: center;
		}

		.indicator {
			position: absolute;
			left: 0;
			right: 0;
			bottom: 120rpx;
			display: flex;
			justify-content: center;
			color: rgba(255, 255, 255, 0.8);
		}
	}
</style>
